{% extends "email/base.html" %}
{% load comments %}
{% load i18n %}
{% block title%}QATrack+ Scheduling Notice{% endblock %}
{% block preheader %}QATrack+ Scheduling Notice{% endblock %}
{% block extra_css %}
  th.header {
    font-weight: bold;
  }
  thead th.header {
    text-align: center;
  }
  thead th {
    font-weight: bold;
    text-align: center;
  }
  tbody th.header {
    padding-right: 10px;
  }
  .due-date {
    text-align: center;
    font-size: 0.9em;
  }
{% endblock %}
{% block content %}
<p>Hello,</p>
<p>
{% if notice.is_all %}
  The following test lists have due dates shown below.
{% elif notice.is_due %}
  The following tests lists are currently due or overdue.
{% elif notice.is_upcoming_and_due %}
  {% if notice.future_days == 0 %}
    The following tests lists are currently due, overdue.
  {% else %}
    The following tests lists are currently due, overdue, or will be due in the next {{ notice.future_days }} days.
  {% endif %}
{% elif notice.is_upcoming %}
  {% if notice.future_days == 0 %}
    The following tests lists are due today.
  {% else %}
    The following tests lists will be due in the next {{ notice.future_days }} days.
  {% endif %}
{% endif %}
</p>
<table style="border: none;" cellspacing="0" cellpadding="0">
  <thead>
    <tr>
      <th class="header" style="border-bottom: 1px solid #ccc;">Unit</th>
      <th style="border-bottom: 1px solid #ccc;">Test List (Cycle)</th>
      <th style="border-bottom: 1px solid #ccc;">Due Date</th>
    </tr>
  </thead>
  <tbody>
    {% regroup notice.utcs_to_notify by unit as utcs %}
    {% for unit, unit_utcs in utcs %}
      {% for utc in unit_utcs %}
        <tr>
          {% if forloop.first %}
            <th class="header">{{ unit.name }}</th>
          {% else %}
            <td>&nbsp;</td>
          {% endif %}
          <td>{{ utc.name }}</td>
          <td class="due-date {{ utc.due_status }}">{% if utc.due_date %}{{ utc.due_date | date }}{% else %}Ad Hoc{% endif %}</td>
        </tr>
      {% endfor %}
    {% endfor %}
  </tbody>
</table>
{% endblock content %}
